package db;

import org.apache.log4j.Logger;
import util.ConfigEnum;
import util.ConfigurationManager;

import java.sql.*;

public class Connect {
    private static Connection conn;
    private static String url;
    private static String user;
    private static String password;
    private static final Logger log = Logger.getLogger(Connect.class);
    public static Connection getConnect() {
        try {
            DriverManager.registerDriver(new oracle.jdbc.OracleDriver());
            url= ConfigurationManager.getInstance().getProperty(ConfigEnum.DATABASE_URL);
            user= ConfigurationManager.getInstance().getProperty(ConfigEnum.DATABASE_USER);
            password= ConfigurationManager.getInstance().getProperty(ConfigEnum.DATABASE_PASSWORD);
            // Connect to the local database
      //      if(conn==null){
                conn = DriverManager.getConnection(url,user,password);
      //      }
        } catch (SQLException e) {
            System.out.println(e);
        }
        return conn;
    }
}
